<?php

namespace App\Api\Models;


use Illuminate\Database\Eloquent\Model;

/**
 * App\Api\Models\Config
 *
 * @property int $id
 * @property string $module 应用模块
 * @property string|null $name 变量名
 * @property string|null $group 分组
 * @property string|null $title 变量标题
 * @property string|null $tip 变量描述
 * @property string|null $type 类型
 * @property string|null $value 变量值
 * @property string|null $content 变量字典数据
 * @property string|null $rule 验证规则
 * @property string|null $extend 扩展属性
 * @property string|null $setting 配置
 * @property int $required 是否必填，0=否，1=是
 * @method static \Illuminate\Database\Eloquent\Builder|Config newModelQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|Config newQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|Config query()
 * @method static \Illuminate\Database\Eloquent\Builder|Config whereContent($value)
 * @method static \Illuminate\Database\Eloquent\Builder|Config whereExtend($value)
 * @method static \Illuminate\Database\Eloquent\Builder|Config whereGroup($value)
 * @method static \Illuminate\Database\Eloquent\Builder|Config whereId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|Config whereModule($value)
 * @method static \Illuminate\Database\Eloquent\Builder|Config whereName($value)
 * @method static \Illuminate\Database\Eloquent\Builder|Config whereRequired($value)
 * @method static \Illuminate\Database\Eloquent\Builder|Config whereRule($value)
 * @method static \Illuminate\Database\Eloquent\Builder|Config whereSetting($value)
 * @method static \Illuminate\Database\Eloquent\Builder|Config whereTip($value)
 * @method static \Illuminate\Database\Eloquent\Builder|Config whereTitle($value)
 * @method static \Illuminate\Database\Eloquent\Builder|Config whereType($value)
 * @method static \Illuminate\Database\Eloquent\Builder|Config whereValue($value)
 * @mixin \Eloquent
 */
class Config extends Model
{

    protected $table = "config";


    public static function getMember(){
        $config = self::query()->where("name","member")->pluck("value","name")->toArray();
        return json_decode($config['member'],true);
    }

    public static function getName($name){
        $config = self::query()->where("name",$name)->pluck("value","name")->toArray();
        return $config[$name]??"";
    }
}
